﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Skynet.Data
{
    internal class LogConfig
    {
        internal void AddLog(string xmlPath)
        {
            
            log4net.Filter.LevelRangeFilter levfilter = new log4net.Filter.LevelRangeFilter();
            levfilter.LevelMax = log4net.Core.Level.Fatal;
            levfilter.LevelMin = log4net.Core.Level.Fatal;

            log4net.Appender.RollingFileAppender appender = new log4net.Appender.RollingFileAppender();
            appender.AppendToFile = true;
            appender.File = @"Log\Access\Log";
            appender.Name = "AccessLog";
            appender.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Date;
            appender.DatePattern = "-yyyyMMdd&quot;.txt&quot;";
            appender.Encoding = Encoding.Default;
            appender.StaticLogFileName = false;

            log4net.Layout.PatternLayout layout = new log4net.Layout.PatternLayout("%d [%t]  %c  %p %n%m%n");

            appender.Layout = layout;
            appender.AddFilter(levfilter);
            appender.ActivateOptions();

            log4net.Config.BasicConfigurator.Configure(appender);
        }
    }
}
